Type 2 diabetes is a major public health concern in Scotland, with its prevalence risng by approximately 40% in the last decade (D. Colhoun & McKnight, 2020). Effective medication management is important for preventing complications and reducing healthcare burden associated with the condition. Prescribing patterns therefore provide valuable insights into population health, but they are ssensitive to changes in healthcare access, media influence and wider social conditions.
The COVID-19 pandemic introduced unprecedented disruption to daily life. Lockdowns contributed to lifestyle changes associated with increased metabolic risk, while restricted access to healthcare may have affected diagnosis and routine management, which may have impacted existing socioeconomic disparities. Diabetes prevalence is 80% higher in the most deprived fifth of the population than in the fifth most affluent, and the gap is widening (D. Colhoun & McKnight, 2020).
This report examines how prescribing of common Type 2 medications, changed during the COVID-19 pandemic across Scotland. The aim is to assess whether the pandemic altered prescribing patterns, and whether these changes differed by levels of socioeconomic deprivation.
Prescription data were obtained from Public Health Scotland’s Prescriptions in the Community dataset, specifically the “Data by Prescriber Location” records, covering the period from January 2020 to December 2021. Population estimates were drawn from the National Records of Scotland 2022 census release (Table UV302: General Health, Health Board Area, 2019). Socioeconomic deprivation was assessed using the Scottish Index of Multiple Deprivation (SIMD) 2020v2 data zone lookup file. NHS Scotland health board boundaries were incorporated using publicly available shapefiles to enable spatial analysis and visualisation in prescribing across regions.
The data was then filtered for type 2 diabetes medications including biguanides (metformin), SGLT2 inhibitors (gliflozins), sulphonylureas (gliclazide, glimepiride), DDP-4 inhibitors (gliptins), GLP-1 receptor agonists (glutides), thiazolidinediones (glitazone), with all available formulations. These filtered data were then processed to generate visual summaries and descriptive analyses.
For the purpose of this study, the COVID-19 period is defined as March 2020 to June 2021, covering the introduction of national lockdown measures through to the lifting of major covid restrictions.
library(tidyverse)
library(janitor) # cleaning data
library(gt) # to create pretty tables
library(here) # directory structure
library(readxl) # read in excel file
library(sf) # to read in map data
library(plotly) # for interactive plot
library(scales) # to add colour scheme
# Get data from 24-month period from Jan 2020 - Dec 2021
# Create function to read data in:
prescriptions_data <- function() {
files <- c(paste0(c("jan", "feb","mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"), "2020"),
paste0(c("jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"), "2021"))
map_dfr(files, ~read_csv(here("data", paste0(.x, ".csv"))) %>%
clean_names() %>%
mutate(file_name = .x))}
# Read in data
data_for_years <- prescriptions_data()
deprivation_stats <- read_excel(here("data/SIMD.xlsx"))# Read in and tidy health board population database
population_data <- read_csv(here("data/general_health_census.csv"), skip = 10) %>%
filter(!is.na('All people')) %>% # Removes NA
rename(hb_name = "General health",
hb_population = "All people") %>%
select(hb_name, hb_population) %>%
filter(!str_detect(hb_population, "Cells")) # Removes rows with text in population (to remove copyright info from data)The results are structured to show how Type 2 diabetes prescribing changed during and after the COVID-19 pandemic across Scotland. Temporal trends are presented first, followed by comparisons of absolute and percentage changes across Health Boards. A final summary table integrates these measures to illustrate variation across Scotland.
First, to understand the overall pattern of prescribing during the COVID-19 pandemic, monthly prescribing rates from January 2020 to December 2022 were examined for each Health Board. Line plots were generated using free y-scales to account for substantial differences in prescription volume between Health Boards, ensuring that trends within boards were more easily comparable.
# Filter for diabetes medications
diabetes_summary <- data_for_years %>%
filter(!is.na(bnf_item_description)) %>%
filter(str_detect(bnf_item_description,
regex("metformin|gliptin|gliflozin|glutide|glitazone|gliclazide|glimepiride", ignore_case = TRUE))) %>% # Search for common diabetes medications whilst gnoring upper and lower cases
group_by(paid_date_month, hbt) %>%
summarise(paid_quantity = sum(paid_quantity, na.rm = TRUE)) %>%
mutate(paid_date_month = ym(paid_date_month)) # Change months from numbers to letters
# Merge all tables together
combined_health_data <- deprivation_stats %>%
full_join(diabetes_summary, join_by(HBcode == hbt)) %>%
left_join(population_data, join_by(HBname == hb_name))
# To calculate prescriptions per person
combined_health_data <- combined_health_data %>%
group_by(HBname, paid_date_month) %>%
mutate(quantity_per_head = sum(paid_quantity, na.rm = TRUE) / mean(as.numeric(hb_population))) # Calculate prescriptions per person and change hb_population to numeric value instead of character# Creating a summary table and filtering for common type 2 medications
totalmeds_plot <- combined_health_data %>%
ggplot(aes(x = paid_date_month, y = quantity_per_head)) +
# Add vertical lines for COVID start and end
geom_vline(xintercept = as.numeric(ymd("2020-03-01")),
linetype = "dashed", colour = "orange") +
geom_vline(xintercept = as.numeric(ymd("2021-06-01")),
linetype = "dashed", colour = "orange") +
geom_line(colour = "purple") +
labs(
title = "Type 2 diabetes medications per person across NHS Healthboards",
subtitle = "January 2020 - December 2021 | Orange dashed lines: COVID-19 period (Mar 2020 - Jun 2021)",
x = "Month",
y = "Quantity per head") +
theme_light() +
theme(axis.text.x = element_text(angle = 45, hjust=1), legend.position = "bottom", plot.title = element_text(face = "bold")) +
facet_wrap(~HBname, scales = "free_y")
print(totalmeds_plot)
All Health Boards showed a marked decline in prescribing at the onset of
COVID-19 in March 2020,, followed by gradual recovery. However, there
was variation in the number of timing of subsequent troughs during the
COVID-19 period, with most experiencing notable dips in early 2021.
Overall, prescribing levels increased across all boards when comparing
pre- and post- pandemic periods.
To quantify these changes January 2020 was selected as the pre-COVID baseline baseline and December 2022 as the post-pandemic comparison point. These timepoints reduce the influence of seasonal variation and allow for consistent comparison between more and less deprived areas. Absolute changes between pre-COVID and post-COVID prescribing were calculated and ordered by deprivation rank.
key_months_data <- combined_health_data %>%
filter(paid_date_month %in% as.Date(c("2020-01-01", "2021-12-01"))) %>%
group_by(HBname) %>%
mutate(covid_phase = case_when(
paid_date_month == as.Date("2020-01-01") ~ "pre_covid",
paid_date_month == as.Date("2021-12-01") ~ "post_covid"))
# Summarise by health board and COVID phase
lollipop_data <- key_months_data %>%
group_by(HBname, covid_phase) %>%
summarise(avg_qph = mean(quantity_per_head, na.rm = TRUE),
avg_simd = mean(SIMD2020v2_Decile, na.rm = TRUE)) %>%
# Pivot to get Pre and Post columns for connecting lines
pivot_wider(names_from = covid_phase, values_from = avg_qph) %>%
mutate(percent_change = round(((post_covid - pre_covid)/pre_covid)*100, 2)) %>% # To calculate percent change and round to 2 d.p
# Arrange by descending avg_simd
arrange(desc(avg_simd)) %>%
ungroup() %>% #before creating a factor so hat HBname can be arranged in order of avg_simd in graph
# Create factor to preserve ordering in plot
mutate(HBname = factor(HBname, levels = HBname))
lollipop_graph <- lollipop_data %>%
ggplot() +
geom_segment(aes(x = HBname, xend = HBname, y = pre_covid, yend = post_covid),
color = "grey") +
geom_point(aes(x = HBname, y = pre_covid,
text = round(pre_covid)),
color = "orange", size = 3) +
geom_point(aes(x = HBname, y = post_covid,
text = round(post_covid)),
color = "purple", size = 3) +
coord_flip() +
theme_minimal() +
theme(plot.title = element_text(face = "bold")) +
xlab("") +
ylab("Average Quantity Per Head") +
ggtitle("Change in Quantity Per Head: Pre-COVID vs Post-COVID",
subtitle = "NHS Health Boards ordered by average SIMD decile (most to least deprived) \n Data from Jan 2020 and Dec 2021")
# Convert to interactive plotly graph
lollipop_interactive <- ggplotly(lollipop_graph, tooltip = "text")
# Display the interactive plot
lollipop_interactiveGreater Glasgow and Clyde, ranked as the third most deprived region, exhibits the largest increase in Type 2 prescriptions per head. Lothian and Lanarkshire also show large increases, while boards such as Shetland and Orkney have smaller increases. Among the top five boards with the greatest increases, three of them, Ayrshire and Arran, Lanarkshire, and Greater Glasgow and Clyde are among the most deprived regions.
However, absolute increases are heavily influenced by population size. To assess the severity of change across boards, percentage increases were examined to provide insights into how dramatically prescribing rose relative to pre-COVID levels, independent of baseline prescribing levels.
# load the NHS Health board Shapefile
NHS_healthboards <- suppressMessages(st_read(here("data/Week6_NHS_HealthBoards_2019.shp"), quiet = TRUE)) #reads in file and hides reading in message
#Join spatial data with other health data
summary_map <- NHS_healthboards %>%
full_join(lollipop_data, by = join_by(HBName == HBname)) %>%
rename(HBname = HBName) # Change column name for consistency# Plot percentage change map
plot_map <- summary_map %>%
ggplot() +
geom_sf(aes(fill = percent_change, text = paste0("Health Board: ", HBname, "\n", round(percent_change,2), "%")), size = 0.3) +
scale_fill_viridis_c(option = "plasma",
name = "% Change in Average Quantity per Head") +
labs(
title = "Percentage Change in Average Type 2 Diabetes Prescriptions Per Head \nPre-COVID → Post-COVID",
caption = "Data from Jan 2020 and Dec 2021"
) +
theme_minimal() +
theme(legend.position = "right", plot.title = element_text(face = "bold"))
interactive_map <- ggplotly(plot_map, tooltip = "text")
interactive_mapUnlike absolute increases, several less populated boards such as Western Isles experienced highest proportional growth, which was also ranked fourth highest deprivation boards. Highland, Lothian and Grampian had the next highest proportional rises. However other most deprived areas such as Ayrshire and Arran, Greater Glasgow and Clyde had one of the lower percentage increases.
To integrate these findings, a summary table presented below, showing each Health Board’s deprivation rank, baseline prescribing, and the observed absolute and percentage increases, allowing direct comparison across boards.
ranked_table <- lollipop_data %>% # replace with your dataframe name
arrange(avg_simd) %>%
mutate(Rank = row_number(),
absolute_change = round(post_covid - pre_covid, 2)) %>%
select(c(Rank, HBname, pre_covid, absolute_change, percent_change))
# ---- Step 2: GT table ----
ranked_table %>%
gt() %>%
cols_label(
Rank = html("Rank<br>(Most to Least Deprived)"), # used to add break on website
HBname = "Health Board",
pre_covid = html("Pre-COVID Level<br>(per head)"),
absolute_change = "Absolute Increase",
percent_change = "Percentage Increase (%)"
) %>%
fmt_number(
columns = c(pre_covid),
decimals = 0) %>%
tab_header(
title = " Health Boards by Percentage Increase in Type 2 Diabetes Prescriptions",
subtitle = "Comparing pre-COVID (Jan 2020) to post-COVID (Dec 2021)"
) %>%
#Colour scale for Absolute Increase
data_color(
columns = absolute_change,
method = "numeric",
palette = "Oranges"
) %>%
# Colour scale for Percentage Increase
data_color(
columns = percent_change,
method = "numeric",
palette = "Purples"
)| Health Boards by Percentage Increase in Type 2 Diabetes Prescriptions | ||||
| Comparing pre-COVID (Jan 2020) to post-COVID (Dec 2021) | ||||
| Rank (Most to Least Deprived) |
Health Board | Pre-COVID Level (per head) |
Absolute Increase | Percentage Increase (%) |
|---|---|---|---|---|
| 1 | Ayrshire and Arran | 1,981 | 372.28 | 18.79 |
| 2 | Lanarkshire | 3,035 | 540.24 | 17.80 |
| 3 | Greater Glasgow and Clyde | 4,992 | 960.94 | 19.25 |
| 4 | Western Isles | 107 | 31.07 | 29.00 |
| 5 | Dumfries and Galloway | 700 | 125.86 | 17.98 |
| 6 | Fife | 1,524 | 274.49 | 18.01 |
| 7 | Tayside | 1,527 | 321.51 | 21.06 |
| 8 | Highland | 1,289 | 302.68 | 23.48 |
| 9 | Forth Valley | 1,455 | 302.45 | 20.79 |
| 10 | Borders | 468 | 93.69 | 20.00 |
| 11 | Orkney | 97 | 18.69 | 19.25 |
| 12 | Lothian | 2,942 | 714.20 | 24.28 |
| 13 | Shetland | 87 | 12.64 | 14.44 |
| 14 | Grampian | 2,040 | 463.12 | 22.70 |
Health Boards with higher pre-COVID levels (e.g. Greater Glasgow and Clyde, Lothian, Grampian) generally show the largest absolute increases, but not always the largest percentage increases. Conversely, boards with low baseline levels (e.g. Western Isles, Orkney, Shetland) often show high percentage increases despite smaller absolute numbers, reflecting a more proportional rise relative to their starting point.
Most deprived areas (e.g. Ayrshire and Arran, Lanarkshire, Greater Glasgow and Clyde), these boards had both high absolute increases and substantial percentage increases, suggesting COVID-19 may have exacerbated existing health inequalities. Some less deprived boards (e.g. Lothian, Highland, Tayside) also show high percentage increases, indicating that the rise in prescriptions isn’t solely tied to deprivation.
Some smaller or remote boards (e.g. Western Isles, Orkney, Shetland) show very high percentage increases despite low absolute numbers, which might suggest local factors such as a sudden rise in diagnosis and treatment post-COVID. Lothian stands out as a board with both a mid-high baseline and a high percentage increase (24.28%), sugesting a significant overall impact.
Across Scotland, every board saw increases in prescriptions, showing a consistent post-COVID rise in Type 2 diabetes treatment, which follows previos patterns of increases seen in Scotland (D. Colhoun & McKnight, 2020). The pattern suggests that both highly deprived boards experienced large absolute rises, while smaller or less deprived baords saw proportionally larger percentage rises, showing a pattern that even though those from more deprived areas have higher prevalence of type 2 diabetes (D. Colhoun & McKnight 2020), people from poorer backgrounds were disproportionately disadvantaged in diabetes monitoring and screening (Hollad et al, 2023).
There are several limitations to this study. Regional differences in prescribing patterns may be influenced by confounders such as local health policies, medication availability, or access to healthcare settings. Additionally, only two time points are compared, so fluctuations during the pandemic are not captured. Finally, average SIMD scores showed little variation, requiring deprivation to be ranked rather than categorized into low- to high-deprived groups.
Future studies could include multiple time points throughout the pandemic to capture fluctuations and provide a more detailed picture of prescribing trends. Additionally, to better understand variation across deprived areas, deprivation should be examined at a smaller georgraphic scale than Health Boards.
To do:
Add ‘NHS’ to Healthboards. Sort out Labels of graphs. Ensure names aren’t cut off e.g Glasgow.
Diabetes in Scotland: a rising tide https://www.thelancet.com/journals/landia/article/PIIS2213-8587(20)30124-8/fulltext
Prescriptions in the Community https://www.opendata.nhs.scot/dataset/prescriptions-in-the-community
Scottish Census: https://www.scotlandscensus.gov.uk/webapi/jsf/tableView/tableView.xhtml
Scottish Index of Multiple Deprivation 2020v2 data zone lookup file https://www.gov.scot/collections/scottish-index-of-multiple-deprivation-2020/#supportingdocuments
NHS shapeboard graph https://www.data.gov.uk/dataset/27d0fe5f-79bb-4116-aec9-a8e565ff756a/nhs-health-boards-scotland
The Effect of the COVID-19 Pandemic on HbA1c Testing: Prioritization of High-Risk Cases and Impact of Social Deprivation https://link.springer.com/article/10.1007/s13300-023-01380-x